package com.robotserver.orders.common;

import java.security.MessageDigest;

/**
 * @author liuqi
 * @date 2021年05月08日 14:38
 */
public class Md5Util {
    private static MessageDigest md5 = null;

    public Md5Util() {
    }

    public static String getMd5(String str) {
        byte[] bs = md5.digest(str.getBytes());
        StringBuilder sb = new StringBuilder(40);
        byte[] arr$ = bs;
        int len$ = bs.length;
        for (int i$ = 0; i$ < len$; ++i$) {
            byte x = arr$[i$];
            if ((x & 255) >> 4 == 0) {
                sb.append("0").append(Integer.toHexString(x & 255));
            } else {
                sb.append(Integer.toHexString(x & 255));
            }
        }
        return sb.toString();
    }

    static {
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (Exception var1) {
            System.out.println(var1.getMessage());
        }
    }
}
